const state = {
  main: 0
}
const ipcRender = require('electron').ipcRenderer

ipcRender.on('file-manager-resp', (event, data) => {
  console.log(data)
})

const mutations = {
  DECREMENT_MAIN_COUNTER (state) {
    state.main--
  },
  INCREMENT_MAIN_COUNTER (state, payload) {
    state.main += payload.amount
  },
  FETCH_FILE_LIST (state, payload) {
    ipcRender.send('file-manager', {type: 'fileList', pageOption: {}})
  }
}

const actions = {
  fetchFileList ({ commit }, payload) {
    // do something async
    commit('FETCH_FILE_LIST', payload)
  }
}

export default {
  state,
  mutations,
  actions
}
